import request from '@/utils/httpRequest'

// 上传csv账单文件
export function uploadFile(data) {
  return request({
    url: '/finance-common-service/checkBill/importForCSV',
    method: 'post',
    data: data || {},
  })
}

// 交易记录上传列表
export async function getUploadList(val) {
  const res = await request({
    url: '/finance-common-service/checkBill/list?month='+val,
    method: 'get'
  })
  return res
}

// 校验是否生成所选月份对账单
export async function checkBills(val) {
  const res = await request({
    url: '/finance-common-service/exportfinance/checkImportData',
    method: 'get',
    params: val || {}
  })
  return res
}

// 生成对账单
export function creatBills(val) {
  return request({
    url: '/finance-common-service/exportfinance/generateFinanceStatistics',
    method: 'get',
    params: val || {}
  })
}

// 重新生成对账单
export function reCreatBills(val) {
  return request({
    url: '/finance-common-service/exportfinance/reGenerateFinanceStatistics',
    method: 'get',
    params: val || {}
  })
}

// 获取历史对账信息
export async function getHistoryList(val) {
  const res = request({
    url: '/finance-common-service/exportfinance/getOrderGoodsFinanceStatisticsList',
    method: 'get',
    params: val || {}
  })
  return res
}

// 查询月份详细列表信息
export function getListDetail(param) {
  return request({
    url: '/finance-common-service/exportfinance/getOrderGoodsFinanceStatisticsDataList',
    method: 'get',
    params: param || {}
  })
}

// 对账明细列表导出
export function exportBill(val) {
  return request({
    url: '/finance-common-service/checkBill/detail/export?statisticsNo='+val,
    method: 'get'
  })
}

// 历史对账记录列表
export async function getStatisticsList(val) {
  const res = request({
    url: '/finance-common-service/checkBill/statistics/list?year='+val,
    method: 'get'
  })
  return res
}

// 对账明细列表
export async function getDetailList(data) {
  const {page, pageSize, isDiff, statisticsNo} = data
  const res = request({
    url: '/finance-common-service/checkBill/detail/list?isDiff='+isDiff+'&statisticsNo='+statisticsNo+'&page='+page+'&pageSize='+pageSize,
    method: 'get',
    data: data || {}
  })
  return res
}

// 获取对账单对应的订单信息
export function getOrderInfo(val) {
  const res = request({
    url: '/bsnl-order/order/load/param/'+val,
    method: 'get'
  })
  return res
}
